package com.hq.myapplicationdemo.model;

import android.text.TextUtils;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.hq.myapplicationdemo.model.enums.AdapterModel;
import com.hq.myapplicationdemo.utils.DateFormatUtils;

import java.io.Serializable;
import java.util.List;

/**
 * 小区信息
 */
public class CommunityInformation implements Serializable, MultiItemEntity {

    private Integer id;
    private Integer communityId;

    private int item= AdapterModel.List.getIndex();//默认是列表;

    /**
     * 区分新小区和旧小区
     */
    private boolean isNew;
    private int collectId;
    /**
     * 出售中数量
     */
    private int selling;
    /**
     * 已出售数量
     */
    private int sold;
    /**
     * 平均售价
     */
    private double averageSell;

    /**
     * 开盘时间
     */
    private String openingDate;
    /**
     * 小区名称
     */
    private String communityName;

    /**
     * 建成年代
     */
    private String builtYear;
    private String builtYearStart;
    private String builtYearEnd;
    /**
     * 地址
     */
    private AddressBean address;
    /**
     * 占地面积
     */
    private Double areaCovered;

    /**
     * 建筑面积
     */
    private Double buildingArea;

    /**
     * 业态组成
     */
    private String formatComposition;

    /**
     * 商业体量
     */
    private Double commercialVolume;

    /**
     * 商住比
     */
    private String commercialResidentialRatio;

    /**
     * 容积率
     */
    private Double volumeRate;

    /**
     * 绿化率
     */
    private String greeningRate;

    /**
     * 规划户数
     */
    private Integer planningHouseholds;

    /**
     * 车位配比
     */
    private String parkingRatio;

    /**
     * 水电燃气
     */
    private String hydropowerGas;

    /**
     * 开发企业
     */
    private String developmentEnterprise;

    /**
     * 物业公司
     */
    private String propertyCompany;

    /**
     * 物业费
     */
    private String propertyCosts;

    /**
     * 物业类型
     */
    private Integer propertyType;

    /**
     *
     */
    private String areaCode;

    /**
     * 平均租金
     */
    private Double averageRent;

    /**
     * 楼盘亮点
     */
    private String realEstateHighlights;

    /**
     * 入驻品牌
     */
    private String settledBrand;

    /**
     * 招租商铺套数，只为传递值
     */
    private Integer leasingShops;

    /**
     * 已租商铺套数，只为传递值
     */
    private Integer rented;

    /**
     * 传递值，图片数组
     */
    private List<String> pictures;

    /**
     * 传递值，物业类型
     */
    private String propertyTypeStr;

    /**
     * 传递值，业态规划
     */
    private String businessPlanning;
    //建筑类型
    private String buildingType;
    //产权年限
    private String propertyRight;
    //规划车位
    private String planningParking;
    //规划楼栋
    private String planningTheBuilding;
    //供暖方式
    private String heatingMethod;
    //供水类型
    private String waterType;
    //供电类型
    private String powerSupplyType;
    //建面范围
    private String constructionArea;
    //业态
    private List<IndustryBean> listIndustry;
    private List<CommunityPicture> listCommunityPicture;

    private AreaBean area;

    public String getConstructionArea() {
        if(TextUtils.isEmpty(constructionArea)) return "暂无";
        if(constructionArea.contains("㎡") || constructionArea.contains("m²")) constructionArea=constructionArea+" ㎡";
        return constructionArea;
    }

    public void setConstructionArea(String constructionArea) {
        this.constructionArea = constructionArea;
    }

    public List<IndustryBean> getListIndustry() {
        return listIndustry;
    }

    public void setListIndustry(List<IndustryBean> listIndustry) {
        this.listIndustry = listIndustry;
    }

    public String getBuildingType() {

        return TextUtils.isEmpty(buildingType)?"暂无":buildingType;
    }

    public void setBuildingType(String buildingType) {
        this.buildingType = buildingType;
    }

    public String getPropertyRight() {
        return TextUtils.isEmpty(propertyRight)?"暂无":propertyRight;
    }

    public void setPropertyRight(String propertyRight) {
        this.propertyRight = propertyRight;
    }

    public String getPlanningParking() {
        return planningParking;
    }

    public void setPlanningParking(String planningParking) {
        this.planningParking = planningParking;
    }

    public String getPlanningTheBuilding() {
        return planningTheBuilding;
    }

    public void setPlanningTheBuilding(String planningTheBuilding) {
        this.planningTheBuilding = planningTheBuilding;
    }

    public String getHeatingMethod() {
        return heatingMethod;
    }

    public void setHeatingMethod(String heatingMethod) {
        this.heatingMethod = heatingMethod;
    }

    public String getWaterType() {
        return waterType;
    }

    public void setWaterType(String waterType) {
        this.waterType = waterType;
    }

    public String getPowerSupplyType() {
        return powerSupplyType;
    }

    public void setPowerSupplyType(String powerSupplyType) {
        this.powerSupplyType = powerSupplyType;
    }

    public boolean isNew() {
        return isNew;
    }

    public void setNew(boolean aNew) {
        isNew = aNew;
    }

    public int getItem() {
        return item;
    }

    public int getSelling() {
        return selling;
    }

    public void setSelling(int selling) {
        this.selling = selling;
    }

    public int getSold() {
        return sold;
    }

    public void setSold(int sold) {
        this.sold = sold;
    }

    public double getAverageSell() {
        return averageSell;
    }

    public void setAverageSell(double averageSell) {
        this.averageSell = averageSell;
    }

    public String getOpeningDate() {
        if (TextUtils.isEmpty(openingDate)){
            return "暂无";
        }
        return openingDate.contains(" ")?openingDate.substring(0,openingDate.indexOf(" ")):"暂无";
    }

    public void setOpeningDate(String openingDate) {
        this.openingDate = openingDate;
    }


    public AddressBean getAddress() {
        return address;
    }

    public void setAddress(AddressBean address) {
        this.address = address;
    }

    public Integer getCommunityId() {
        return communityId;
    }

    public void setCommunityId(Integer communityId) {
        this.communityId = communityId;
    }

    public int getCollectId() {
        return collectId;
    }

    public void setCollectId(int collectId) {
        this.collectId = collectId;
    }

    public String getBuiltYearStart() {
        return DateFormatUtils.getFormatYear(builtYearStart);
    }

    public void setBuiltYearStart(String builtYearStart) {
        this.builtYearStart = builtYearStart;
    }

    public String getBuiltYearEnd() {
        return DateFormatUtils.getFormatYear(builtYearEnd);
    }

    public void setBuiltYearEnd(String builtYearEnd) {
        this.builtYearEnd = builtYearEnd;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    private List<CommunityPeripheralSupporting> listCommunityPeripheralSupporting;

    public String getCommunityName() {
        return communityName;
    }

    public void setCommunityName(String communityName) {
        this.communityName = communityName;
    }

    public String getBuiltYear() {
        return builtYear;
    }

    public void setBuiltYear(String builtYear) {
        this.builtYear = builtYear;
    }

    public Double getAreaCovered() {
        return areaCovered;
    }

    public void setAreaCovered(Double areaCovered) {
        this.areaCovered = areaCovered;
    }

    public Double getBuildingArea() {
        return buildingArea;
    }

    public void setBuildingArea(Double buildingArea) {
        this.buildingArea = buildingArea;
    }

    public String getFormatComposition() {
        return formatComposition;
    }

    public void setFormatComposition(String formatComposition) {
        this.formatComposition = formatComposition;
    }

    public Double getCommercialVolume() {
        return commercialVolume;
    }

    public void setCommercialVolume(Double commercialVolume) {
        this.commercialVolume = commercialVolume;
    }

    public String getCommercialResidentialRatio() {
        return commercialResidentialRatio;
    }

    public void setCommercialResidentialRatio(String commercialResidentialRatio) {
        this.commercialResidentialRatio = commercialResidentialRatio;
    }

    public Double getVolumeRate() {
        return volumeRate;
    }

    public void setVolumeRate(Double volumeRate) {
        this.volumeRate = volumeRate;
    }

    public String getGreeningRate() {
        return greeningRate;
    }

    public void setGreeningRate(String greeningRate) {
        this.greeningRate = greeningRate;
    }

    public Integer getPlanningHouseholds() {
        return planningHouseholds;
    }

    public void setPlanningHouseholds(Integer planningHouseholds) {
        this.planningHouseholds = planningHouseholds;
    }

    public String getParkingRatio() {
        return parkingRatio;
    }

    public void setParkingRatio(String parkingRatio) {
        this.parkingRatio = parkingRatio;
    }

    public String getHydropowerGas() {
        return TextUtils.isEmpty(hydropowerGas)?"暂无":hydropowerGas;
    }

    public void setHydropowerGas(String hydropowerGas) {
        this.hydropowerGas = hydropowerGas;
    }

    public String getDevelopmentEnterprise() {
        return TextUtils.isEmpty(developmentEnterprise)?"暂无":developmentEnterprise;
    }

    public void setDevelopmentEnterprise(String developmentEnterprise) {
        this.developmentEnterprise = developmentEnterprise;
    }

    public String getPropertyCompany() {
        return TextUtils.isEmpty(propertyCompany)?"暂无":propertyCompany;
    }

    public void setPropertyCompany(String propertyCompany) {
        this.propertyCompany = propertyCompany;
    }

    public String getPropertyCosts() {
        return TextUtils.isEmpty(propertyCosts)?"暂无":propertyCosts;
    }

    public void setPropertyCosts(String propertyCosts) {
        this.propertyCosts = propertyCosts;
    }

    public Integer getPropertyType() {
        return propertyType;
    }

    public void setPropertyType(Integer propertyType) {
        this.propertyType = propertyType;
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public Double getAverageRent() {
        return averageRent==null?0:averageRent;
    }

    public void setAverageRent(Double averageRent) {
        this.averageRent = averageRent;
    }

    public String getRealEstateHighlights() {
        return TextUtils.isEmpty(realEstateHighlights)?"暂无":realEstateHighlights;
    }

    public void setRealEstateHighlights(String realEstateHighlights) {
        this.realEstateHighlights = realEstateHighlights;
    }

    public String getSettledBrand() {
        return settledBrand;
    }

    public void setSettledBrand(String settledBrand) {
        this.settledBrand = settledBrand;
    }

    public Integer getLeasingShops() {
        return leasingShops==null?0:leasingShops;
    }

    public void setLeasingShops(Integer leasingShops) {
        this.leasingShops = leasingShops;
    }

    public Integer getRented() {
        return rented;
    }

    public void setRented(Integer rented) {
        this.rented = rented;
    }

    public List<String> getPictures() {
        return pictures;
    }

    public void setPictures(List<String> pictures) {
        this.pictures = pictures;
    }

    public String getPropertyTypeStr() {
        return TextUtils.isEmpty(propertyTypeStr)?"暂无":propertyTypeStr;
    }

    public void setPropertyTypeStr(String propertyTypeStr) {
        this.propertyTypeStr = propertyTypeStr;
    }

    public String getBusinessPlanning() {
        return TextUtils.isEmpty(businessPlanning)?"暂无":businessPlanning;
    }

    public void setBusinessPlanning(String businessPlanning) {
        this.businessPlanning = businessPlanning;
    }

    public List<CommunityPicture> getListCommunityPicture() {
        return listCommunityPicture;
    }

    public void setListCommunityPicture(List<CommunityPicture> listCommunityPicture) {
        this.listCommunityPicture = listCommunityPicture;
    }

    public AreaBean getArea() {
        return area;
    }

    public void setArea(AreaBean area) {
        this.area = area;
    }

    public List<CommunityPeripheralSupporting> getListCommunityPeripheralSupporting() {
        return listCommunityPeripheralSupporting;
    }

    public void setListCommunityPeripheralSupporting(List<CommunityPeripheralSupporting> listCommunityPeripheralSupporting) {
        this.listCommunityPeripheralSupporting = listCommunityPeripheralSupporting;
    }

    public String getShowPic(){
        if(listCommunityPicture == null) return null;
        if(listCommunityPicture.size()<1) return null;
        CommunityPicture communityPicture = listCommunityPicture.get(0);
        List<String> picList= communityPicture.getPictures();
        if(picList == null) return null;
        if(picList.size()<1) return null;
        return picList.get(0);
    }

    @Override
    public int getItemType() {
        return item;
    }

    public void setItem(int item) {
        this.item = item;
    }

    @Override
    public String toString() {
        return "CommunityInformation{" +
                "id=" + id +
                ", communityId=" + communityId +
                ", item=" + item +
                ", collectId=" + collectId +
                ", selling=" + selling +
                ", sold=" + sold +
                ", averageSell=" + averageSell +
                ", openingDate='" + openingDate + '\'' +
                ", communityName='" + communityName + '\'' +
                ", builtYear='" + builtYear + '\'' +
                ", builtYearStart='" + builtYearStart + '\'' +
                ", builtYearEnd='" + builtYearEnd + '\'' +
                ", address=" + address +
                ", areaCovered=" + areaCovered +
                ", buildingArea=" + buildingArea +
                ", formatComposition='" + formatComposition + '\'' +
                ", commercialVolume=" + commercialVolume +
                ", commercialResidentialRatio='" + commercialResidentialRatio + '\'' +
                ", volumeRate=" + volumeRate +
                ", greeningRate='" + greeningRate + '\'' +
                ", planningHouseholds=" + planningHouseholds +
                ", parkingRatio='" + parkingRatio + '\'' +
                ", hydropowerGas='" + hydropowerGas + '\'' +
                ", developmentEnterprise='" + developmentEnterprise + '\'' +
                ", propertyCompany='" + propertyCompany + '\'' +
                ", propertyCosts='" + propertyCosts + '\'' +
                ", propertyType=" + propertyType +
                ", areaCode='" + areaCode + '\'' +
                ", averageRent=" + averageRent +
                ", realEstateHighlights='" + realEstateHighlights + '\'' +
                ", settledBrand='" + settledBrand + '\'' +
                ", leasingShops=" + leasingShops +
                ", rented=" + rented +
                ", pictures=" + pictures +
                ", propertyTypeStr='" + propertyTypeStr + '\'' +
                ", businessPlanning='" + businessPlanning + '\'' +
                ", listCommunityPicture=" + listCommunityPicture +
                ", area=" + area +
                ", listCommunityPeripheralSupporting=" + listCommunityPeripheralSupporting +
                '}';
    }
}